package com.sean.order.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Resource
    RestTemplate restTemplate;

    @GetMapping("/add")
    public String add(){
        String msg = restTemplate.getForObject("http://stock-nacos/stock/reduce", String.class);
        System.out.println("OrderController: 下单成功");
        return "OrderController: msg = " + msg;
    }
}
